<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<link href="${pageContext.request.contextPath}/css/org_manager.css"
	rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/add_new_org.css"
	rel="stylesheet" type="text/css" />
<jsp:useBean id="testBean"
	class="team02.server.bean.TestBean" scope="session"></jsp:useBean>
<script>
function check_selected() {
	var test = document.getElementsByName("selected_id");
	var sizes = test.length;
	for ( var i = 0; i < sizes; i++)
		if (test[i].checked)
			return true;
	alert("一つの回答者を選択してください！");
	return false;
}
function error(){
	alert("テストがまだ実施しません");
	window.location="test_manager.t02";
}
</script>

<div class="menu1"><%@include file="/jsputils/menu.jsp"%>
	<div class = "greeting_message">
		<%@include file="/jsputils/greeting.jsp"%>
	</div>
</div>
<%
//権限をチェック

if(request.getParameterMap().containsKey("selected_id"))
{
	
testBean.setId(Integer.parseInt(request.getParameter("selected_id")));
testBean.load();
Date today=new Date();
if(testBean.getEndTime()>today.getTime())
	{
		%>
		<script>error();</script>
		<%
	}
}

%>
<c:set value="<%=examineeBean.listAllSubmittedExaminees(testBean.getTest())%>" var="listExaminee"></c:set>
<div class="container">
<form action="" method="post" name="form" class="table_content">
	<div class="menu">
		<p class="menu_label">テスト採点</p> 
		<p class="menu_item">
			<button type="submit" formaction="test_mark2.t02" onclick="return check_selected()">テスト採点 </button>
		</p>
	</div>
		<table style="width: 100%" class="table_content">
			<tr>
				<th></th>
				<th>回答者名</th>
				<th>ログイン名</th>
				<th>得点1</th>
				<th>得点2</th>
				<th>採点した</th>
			</tr>
			<c:forEach var="examineeItem" items="${listExaminee}">
				<tr>
					<td><input type="radio" name="selected_id"
						value="${examineeItem.getId()}"></td>
					<td>${examineeItem.getName()}</td>
					<td>${examineeItem.getUsername()}</td>
					<td>${examineeItem.getScore() }</td>
					<td>${examineeItem.getScore2() }</td>
					<td style="text-align: center;">
						<c:choose>
						<c:when test="${examineeItem.isMarked()==true}">
							<img src="../images/marked_examinee.jpg"  style="width: 20px;height: 20px"> 	
					 	</c:when>
						</c:choose>
					</td>
				</tr>
			</c:forEach>
		</table>
		<input type="hidden" name="testId" value="<%=testBean.getId()%>">
		<input type="hidden" name="testTitle" value="<%=testBean.getTitle()%>">
		<input type="hidden" name="testSubTitle" value="<%=testBean.getSubtitle()%>">
</form>
</div>